#include "movieDetailMessageHandler.h"
#include "movieDetailMessage.h"
#include "movieDetailResMessage.h"
#include "movieService.h"

void MovieDetailMessageHandler::handle(Message<String>* message, const IPaddress& attachment)
{
	MovieDetailMessage* msg = (MovieDetailMessage*)message;
	Movie* m = MovieService::inst().findMovie(msg->getMovieId());
	MovieDetailResMessage p(m, (const MtpMessage*)message);
	p.send(attachment);
}

Message<String>* MovieDetailMessageHandler::decode(Protocol<String>* packet, const IPaddress& attachment)
{
	return new MovieDetailMessage((MtpProtocol * )packet);
}
